Remove HTML tags from webpages using regular expressionsRegular Expression htmlAfter capturing the data of a webpage (such as the description), if it is displayed as is, the format may be messy because it contains no closed HTML Tag, it may also
In some cases, users are prohibited from submitting HTML-containing content due to security considerations. However, client verification and restrictions are always untrusted.
At this time, we need to securely process the submitted content and
Method 1: Disable html
The simplest way is to directly disable HTML tags without removing them. You can use the Replace () function. For example:
Strtext = Replace (strtext, "
Or directly disable all HTML:Strtext = Replace (strtext, "
Remove the HTML tag from a text segment to remove the style and paragraph contained in it. The most common method may be regular expressions. However, you must note that regular expressions cannot process all HTML documents. Therefore, it is better
From = "robby.cnblogs.com" @>
As this part of the content is implemented in your search engine, today we will talk about how to capture webpage data, analyze and remove HTML tags, so as to provide you with a reference. My platform is visualStudio2005
Remove all tags in HTML code
Copy codeThe Code is as follows: '******************************
'Function: RemoveHTML_A (strText)
'Parameter: strText, string to be processed
'Prepared by: alixixi
'Date: 2007/7/12
'Description: removes all tags from
Using system. Text. regularexpressions;
///
/// Remove HTML tags
///
/// including the source code of HTML
/// removed text
Public static string nohtml (string htmlstring)
{
// Delete the script
Htmlstring = RegEx. Replace
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.